export class UaCard {
  id?: number;
  limitCount?: number;
  cardTitle?: string;
  cardNo?: string;
  packNo?: string;
  cardDeckNo?: string;
  cardRealNo?: string;
  cardConflict?: string;
  rare?: string;
  cardName?: string;
  cardRuby?: string;
  cardImg?: string;
  cardImgSm?: string;
  cardtitleLogo?: string;
  needEnergyCount?: number;
  needEnergyType?: EnergyType;
  needEnergyImg?: string;
  needAp?: number;
  cardCategory?: CardCategory;
  bp?: number;
  bpSubFix?: string;
  attribute?: string[];
  generateEnergyCount?: number;
  generateEnergyType?: EnergyType;
  generateEnergyPlus?: boolean;
  generateEnergyImg?: string;
  effects?: Effect[];
  effectsZh?: Effect[];
  trigger?: string;
  triggerImg?: string;
  triggerType?: TriggerType;
  qas?: Qa[];
  qasZh?: Qa[];
  // 仅测试部分使用
  asFold?: boolean;
}

export class UaCardSearchRequest {
  ipId?: number;
  packNo?: string;
  limitCount?: number;
  cardName?: string;
  rare?: string;
  needEnergyCountMin?: number;
  needEnergyCountMax?: number;
  needEnergyType?: EnergyType;
  needApMin?: number;
  needApMax?: number;
  cardCategory?: CardCategory;
  bpMin?: number;
  bpMax?: number;
  attribute?: string;
  generateEnergyCountMin?: number;
  generateEnergyCountMax?: number;
  generateEnergyType?: EnergyType;
  triggerType?: TriggerType;
  cardKeyWords?: string;
}


export enum CardCategory {
  Character = 'Character',
  Event = 'Event',
  Field = 'Field',
}

export const CardCategoryMap = {
  [CardCategory.Character]: '角色',
  [CardCategory.Event]: '事件',
  [CardCategory.Field]: '场地'
}

export const CardCategoryList = [{
  label: CardCategoryMap[CardCategory.Character],
  value: CardCategory.Character,
}, {
  label: CardCategoryMap[CardCategory.Event],
  value: CardCategory.Event,
}, {
  label: CardCategoryMap[CardCategory.Field],
  value: CardCategory.Field,
}];

export const RareList = [{
  label: 'C',
  value: 'C',
}, {
  label: 'C★',
  value: 'C★',
}, {
  label: 'C★★',
  value: 'C★★',
}, {
  label: 'U',
  value: 'U',
}, {
  label: 'U★',
  value: 'U★',
}, {
  label: 'U★★',
  value: 'U★★',
}, {
  label: 'U★★★',
  value: 'U★★★',
}, {
  label: 'R',
  value: 'R',
}, {
  label: 'R★',
  value: 'R★',
}, {
  label: 'R★★',
  value: 'R★★',
}, {
  label: 'SR',
  value: 'SR',
}, {
  label: 'SR★',
  value: 'SR★',
}, {
  label: 'SR★★',
  value: 'SR★★',
}, {
  label: 'SR★★★',
  value: 'SR★★★',
}, {
  label: 'UR',
  value: 'UR',
}, {
  label: 'SP',
  value: 'SP',
}, {
  label: 'PR',
  value: 'PR',
}]

export enum EnergyType {
  Green = 'Green',
  Red = 'Red',
  Blue = 'Blue',
  Yellow = 'Yellow',
  Purple = 'Purple',
}

export const EnergyTypeMap = {
  [EnergyType.Green]: '绿',
  [EnergyType.Red]: '红',
  [EnergyType.Blue]: '蓝',
  [EnergyType.Yellow]: '黄',
  [EnergyType.Purple]: '紫',
}

export const EnergyTypeList = [{
  label: EnergyTypeMap[EnergyType.Green],
  value: EnergyType.Green
}, {
  label: EnergyTypeMap[EnergyType.Red],
  value: EnergyType.Red
}, {
  label: EnergyTypeMap[EnergyType.Blue],
  value: EnergyType.Blue
}, {
  label: EnergyTypeMap[EnergyType.Yellow],
  value: EnergyType.Yellow
}, {
  label: EnergyTypeMap[EnergyType.Purple],
  value: EnergyType.Purple
}];

export class Effect {
  effectImg?: string;
  newLine?: boolean;
  effect?: string;
}

export enum TriggerType {
  Active = 'Active',
  Get = 'Get',
  Draw = 'Draw',
  Raid = 'Raid',
  Color = 'Color',
  Final = 'Final',
  Special = 'Special',
}

export const TriggerTypeMap = {
  [TriggerType.Active]: "激活",
  [TriggerType.Get]: "获得",
  [TriggerType.Draw]: "抽牌",
  [TriggerType.Raid]: "突进",
  [TriggerType.Color]: "Color",
  [TriggerType.Final]: "Final",
  [TriggerType.Special]: "Special"
}

export const TriggerTypeLogoMap = {
  [TriggerType.Active]: "/zh/images/cardlist/icon/trigger/ico_active_trigger.png",
  [TriggerType.Get]: "/zh/images/cardlist/icon/trigger/ico_get_trigger.png",
  [TriggerType.Draw]: "/zh/images/cardlist/icon/trigger/ico_draw_trigger.png",
  [TriggerType.Raid]: "/zh/images/cardlist/icon/trigger/ico_raid_trigger.png",
  [TriggerType.Color]: "/zh/images/cardlist/icon/trigger/ico_color_trigger.png",
  [TriggerType.Final]: "/zh/images/cardlist/icon/trigger/ico_final_trigger.png",
  [TriggerType.Special]: "/zh/images/cardlist/icon/trigger/ico_special_trigger.png"
}

export const TriggerStrMap = {
  [TriggerType.Active]: "选择自己场上的1张角色，转为激活状态，本回合中，BP+3000。",
  [TriggerType.Get]: "本卡片加入手牌。",
  [TriggerType.Draw]: "抽1张牌。",
  [TriggerType.Raid]: "本卡片加入手牌，或能量需求被满足的场合，进行突进。",
  [TriggerType.Color]: "-",
  [TriggerType.Final]: "自己生命区为空的场合，从自己的卡组上方放置1张牌到自己的生命区。",
  [TriggerType.Special]: "选择对手前线的1张角色，退场。"
}

export const TriggerColorStrMap = {
  [EnergyType.Green]: '选择自己手牌1张能量需求为2以下且消费AP为1的绿色角色，在自己的场上激活登场。',
  [EnergyType.Red]: '选择对手前线1张BP2500以下的角色，退场。',
  [EnergyType.Blue]: '选择对手前线1张BP3500以下的角色，回到手牌。',
  [EnergyType.Yellow]: '选择对手前线1张角色转为休息状态。下次转为激活时无法激活。',
  [EnergyType.Purple]: '选择自己场外1张能量需求为2以下且消费AP为1的紫色角色，在自己的前线激活登场。',
}


export const TriggerTypeList = [{
  label: TriggerTypeMap[TriggerType.Active],
  value: TriggerType.Active
}, {
  label: TriggerTypeMap[TriggerType.Get],
  value: TriggerType.Get
}, {
  label: TriggerTypeMap[TriggerType.Draw],
  value: TriggerType.Draw
}, {
  label: TriggerTypeMap[TriggerType.Raid],
  value: TriggerType.Raid
}, {
  label: TriggerTypeMap[TriggerType.Color],
  value: TriggerType.Color
}, {
  label: TriggerTypeMap[TriggerType.Special],
  value: TriggerType.Special
}, {
  label: TriggerTypeMap[TriggerType.Final],
  value: TriggerType.Final
}]

export class Qa {
  title?: string;
  question?: string;
  answer?: string;
  updateDate?: Date;
  updateDateStr?: string;
}

export enum BattleAreaType {
  DECK = 'DECK',
  LIFE = 'LIFE',
  OUTSIDE = 'OUTSIDE',
  REMOVE = 'REMOVE',
  HAND = 'HAND',
  OP = 'OP',
  DISPLAY = 'DISPLAY',
  F1 = 'F1',
  F2 = 'F2',
  F3 = 'F3',
  F4 = 'F4',
  E1 = 'E1',
  E2 = 'E2',
  E3 = 'E3',
  E4 = 'E4',
}

export const BattleAreaTypeMap = {
  [BattleAreaType.DECK]: '卡组',
  [BattleAreaType.LIFE]: '生命区',
  [BattleAreaType.OUTSIDE]: '场外',
  [BattleAreaType.REMOVE]: '移除区',
  [BattleAreaType.HAND]: '手牌',
  [BattleAreaType.OP]: '临时区',
  [BattleAreaType.DISPLAY]: '展示区',
  [BattleAreaType.F1]: '前线1',
  [BattleAreaType.F2]: '前线2',
  [BattleAreaType.F3]: '前线3',
  [BattleAreaType.F4]: '前线4',
  [BattleAreaType.E1]: '能量线1',
  [BattleAreaType.E2]: '能量线2',
  [BattleAreaType.E3]: '能量线3',
  [BattleAreaType.E4]: '能量线4',
}

export const BattleAreaTypeSwitchOptions = [{
  value: BattleAreaType.F1,
  label: BattleAreaTypeMap[BattleAreaType.F1]
}, {
  value: BattleAreaType.F2,
  label: BattleAreaTypeMap[BattleAreaType.F2]
}, {
  value: BattleAreaType.F3,
  label: BattleAreaTypeMap[BattleAreaType.F3]
}, {
  value: BattleAreaType.F4,
  label: BattleAreaTypeMap[BattleAreaType.F4]
}, {
  value: BattleAreaType.E1,
  label: BattleAreaTypeMap[BattleAreaType.E1]
}, {
  value: BattleAreaType.E2,
  label: BattleAreaTypeMap[BattleAreaType.E2]
}, {
  value: BattleAreaType.E3,
  label: BattleAreaTypeMap[BattleAreaType.E3]
}, {
  value: BattleAreaType.E4,
  label: BattleAreaTypeMap[BattleAreaType.E4]
}]

export const BattleAreaTypeOptions = [{
  value: BattleAreaType.F1,
  label: BattleAreaTypeMap[BattleAreaType.F1]
}, {
  value: BattleAreaType.F2,
  label: BattleAreaTypeMap[BattleAreaType.F2]
}, {
  value: BattleAreaType.F3,
  label: BattleAreaTypeMap[BattleAreaType.F3]
}, {
  value: BattleAreaType.F4,
  label: BattleAreaTypeMap[BattleAreaType.F4]
}, {
  value: BattleAreaType.E1,
  label: BattleAreaTypeMap[BattleAreaType.E1]
}, {
  value: BattleAreaType.E2,
  label: BattleAreaTypeMap[BattleAreaType.E2]
}, {
  value: BattleAreaType.E3,
  label: BattleAreaTypeMap[BattleAreaType.E3]
}, {
  value: BattleAreaType.E4,
  label: BattleAreaTypeMap[BattleAreaType.E4]
}, {
  value: BattleAreaType.HAND,
  label: BattleAreaTypeMap[BattleAreaType.HAND]
}, {
  value: BattleAreaType.REMOVE,
  label: BattleAreaTypeMap[BattleAreaType.REMOVE]
}, {
  value: BattleAreaType.OUTSIDE,
  label: BattleAreaTypeMap[BattleAreaType.OUTSIDE]
}, {
  value: BattleAreaType.DECK,
  label: BattleAreaTypeMap[BattleAreaType.DECK]
}, {
  value: BattleAreaType.OP,
  label: BattleAreaTypeMap[BattleAreaType.OP]
}, {
  value: BattleAreaType.DISPLAY,
  label: BattleAreaTypeMap[BattleAreaType.DISPLAY]
}, {
  value: BattleAreaType.LIFE,
  label: BattleAreaTypeMap[BattleAreaType.LIFE]
}]

export enum BattleAreaActionType {
  MOVE_TOP = 'MOVE_TOP',
  MOVE_BOTTOM = 'MOVE_BOTTOM',
  FOLD_TOP = 'FOLD_TOP',
  FOLD_BOTTOM = 'FOLD_BOTTOM',
  SWITCH = 'SWITCH'
}

export const BattleAreaActionTypeMap = {
  [BattleAreaActionType.MOVE_TOP]: '移动到...上方',
  [BattleAreaActionType.MOVE_BOTTOM]: '移动到...下方',
  [BattleAreaActionType.FOLD_TOP]: '盖牌到...上方',
  [BattleAreaActionType.FOLD_BOTTOM]: '盖牌到...下方',
  [BattleAreaActionType.SWITCH]: '换位到...(前线或能量线)',
}

export class BattleArea {
  [key: string]: UaCard[];

  constructor() {
    this[BattleAreaType.DECK] = [];
    this[BattleAreaType.HAND] = [];
    this[BattleAreaType.LIFE] = [];
    this[BattleAreaType.OUTSIDE] = [];
    this[BattleAreaType.REMOVE] = [];
    this[BattleAreaType.OP] = [];
    this[BattleAreaType.DISPLAY] = [];
    this[BattleAreaType.F1] = [];
    this[BattleAreaType.F2] = [];
    this[BattleAreaType.F3] = [];
    this[BattleAreaType.F4] = [];
    this[BattleAreaType.E1] = [];
    this[BattleAreaType.E2] = [];
    this[BattleAreaType.E3] = [];
    this[BattleAreaType.E4] = [];
  }
}

export class UaVideoEntity {
  id?: number;
  aid?: string;
  userId?: number;
  author?: string;
  title?: string;
  cover?: string;
  url?: string;
  shortLink?: string;
  uploadDate?: Date;
  videoType?: VideoType;
  hot?: number;
  view?: number;
  uploadDateStr?: string;
}

export class UaVideoSearchDto {
  userId?: number;
  videoType?: VideoType;
}
export enum VideoType {
  BATTLE = 'BATTLE', // 对战视频
  TUTORIAL = 'TUTORIAL', // 教学视频
  HIGH_LIGHT = 'HIGH_LIGHT', // 精彩片段
  NEWBEE = 'NEWBEE', // 新手教程
  REPOST = 'REPOST', // 转载视频
  INTRO = 'INTRO', // 介绍视频
  DEFAULT = 'DEFAULT', // 默认分类
}

export const VideoTypeMap = {
  [VideoType.BATTLE]: '对战视频',
  [VideoType.TUTORIAL]: '教学视频',
  [VideoType.HIGH_LIGHT]: '精彩片段',
  [VideoType.NEWBEE]: '新手教程',
  [VideoType.REPOST]: '视频转载',
  [VideoType.INTRO]: '卡组介绍',
  [VideoType.DEFAULT]: '默认分类'
}

export const VideoTypeOptions = [{
  value: VideoType.BATTLE,
  label: VideoTypeMap[VideoType.BATTLE]
}, {
  value: VideoType.TUTORIAL,
  label: VideoTypeMap[VideoType.TUTORIAL]
}, {
  value: VideoType.HIGH_LIGHT,
  label: VideoTypeMap[VideoType.HIGH_LIGHT]
}, {
  value: VideoType.NEWBEE,
  label: VideoTypeMap[VideoType.NEWBEE]
}, {
  value: VideoType.REPOST,
  label: VideoTypeMap[VideoType.REPOST]
}, {
  value: VideoType.INTRO,
  label: VideoTypeMap[VideoType.INTRO]
}, {
  value: VideoType.DEFAULT,
  label: VideoTypeMap[VideoType.DEFAULT]
},]
